/* 
 * 桌布網站自定義样式
 * 多彩主題風格
 */

:root {
    --primary-color: #8E44AD;       /* 紫色作為主色調 */
    --secondary-color: #3498DB;     /* 藍色作為次要色調 */
    --accent-color: #E74C3C;        /* 紅色作為強調色 */
    --success-color: #2ECC71;       /* 綠色 */
    --warning-color: #F39C12;       /* 橙色 */
    --info-color: #1ABC9C;          /* 青綠色 */
    --light-color: #F5F7FA;         /* 淺灰色背景 */
    --dark-color: #34495E;          /* 深色文字 */
    --gradient-primary: linear-gradient(135deg, #9B59B6 0%, #8E44AD 100%);
    --gradient-secondary: linear-gradient(135deg, #3498DB 0%, #2980B9 100%);
    --gradient-accent: linear-gradient(135deg, #E74C3C 0%, #C0392B 100%);
    --desktop-wallpaper-color: var(--primary-color);  /* 電腦桌布顏色 */
    --mobile-wallpaper-color: var(--accent-color);    /* 手機桌布顏色 */
}

body {
    font-family: 'Microsoft JhengHei', 'PingFang TC', sans-serif;
    color: var(--dark-color);
    background-color: var(--light-color);
    background-image: linear-gradient(to right, rgba(142, 68, 173, 0.05), rgba(52, 152, 219, 0.05));
}

/* 導航欄樣式 */
.navbar {
    background: linear-gradient(135deg, #9B59B6 0%, #8E44AD 100%);
    box-shadow: 0 2px 10px rgba(142, 68, 173, 0.3);
}

.navbar a.text-white:hover {
    color: var(--warning-color) !important;
}

/* 按鈕樣式 */
.btn-primary {
    background-color: var(--primary-color);
}

.btn-accent {
    background-color: var(--accent-color);
}

/* 標籤樣式 */
.tag {
    background-color: var(--secondary-color);
}

/* 卡片懸停效果 */
.hover-card {
    transition: all 0.3s ease;
}

.hover-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* 页脚样式 */
.footer {
    background: linear-gradient(135deg, #34495E 0%, #2C3E50 100%);
    color: var(--light-color);
}

/* 分類圖標顏色 */
.category-icon {
    color: var(--primary-color);
}

.category-icon.cat-1 { color: var(--primary-color); }    /* 風景 */
.category-icon.cat-2 { color: var(--secondary-color); }  /* 動漫 */
.category-icon.cat-3 { color: var(--accent-color); }     /* 遊戲 */
.category-icon.cat-4 { color: var(--info-color); }       /* 藝術 */
.category-icon.cat-5 { color: var(--success-color); }    /* 動物 */
.category-icon.cat-6 { color: var(--warning-color); }    /* 汽車 */
.category-icon.cat-7 { color: #9C27B0; }                 /* 科技 */
.category-icon.cat-8 { color: #FF5722; }                 /* 節日 */

/* 主頁橫幅區域 */
.banner-overlay {
    background: linear-gradient(135deg, rgba(142, 68, 173, 0.8) 0%, rgba(52, 152, 219, 0.6) 100%);
}

/* 搜索框樣式 */
.search-box input {
    border: 2px solid var(--primary-color);
    transition: all 0.3s ease;
}

.search-box input:focus {
    box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.3);
    border-color: var(--primary-color);
}

.search-btn {
    background-color: var(--accent-color);
}

/* 下載按鈕樣式 */
.download-btn {
    background: linear-gradient(135deg, #E74C3C 0%, #C0392B 100%);
    transition: all 0.3s ease;
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(231, 76, 60, 0.4);
}

/* 輪播圖導航按鈕樣式 */
.swiper-button-next, 
.swiper-button-prev {
    color: var(--primary-color) !important;
}

/* 標籤雲樣式 */
.tag-cloud span {
    background-color: rgba(52, 152, 219, 0.2);
    color: var(--secondary-color);
    border-radius: 50px;
    padding: 5px 12px;
    font-size: 13px;
    transition: all 0.3s ease;
}

.tag-cloud span:hover {
    background-color: var(--secondary-color);
    color: white;
}

/* 分頁樣式 */
.pagination .active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.pagination a:hover {
    background-color: rgba(142, 68, 173, 0.1);
}

/* 空狀態樣式 */
.empty-state-icon {
    color: #E0E0E0;
}

/* 動畫效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fadeIn {
    animation: fadeIn 0.8s ease forwards;
}

/* 桌布類型樣式 */
/* 電腦桌布 */
.desktop-card {
    aspect-ratio: 16/9;
    height: auto;
}

/* 手機桌布 */
.mobile-card {
    aspect-ratio: 9/16;
    height: auto;
}

/* 桌布類型標籤樣式 */
.desktop-badge {
    background-color: var(--desktop-wallpaper-color);
}

.mobile-badge {
    background-color: var(--mobile-wallpaper-color);
}

/* 標簽切換樣式 */
.tab-button {
    position: relative;
    transition: all 0.3s ease;
}

.tab-button:after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background-color: var(--primary-color);
    transition: all 0.3s ease;
}

.tab-button.active {
    color: var(--primary-color);
}

.tab-button.active:after {
    width: 80%;
}

/* 針對電腦/手機桌布的差異樣式 */
.desktop-theme .tab-button.active:after {
    background-color: var(--desktop-wallpaper-color);
}

.mobile-theme .tab-button.active:after {
    background-color: var(--mobile-wallpaper-color);
}

/* 類型過濾器 */
.type-filter a {
    transition: all 0.3s ease;
}

.type-filter a:hover {
    transform: translateY(-2px);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 50px;
    list-style: none;
    padding: 0;
}

.pagination li {
    border-radius: 8px;
    margin: 0;
}

.pagination li a,
.pagination li span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--border-radius);
    background: white;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.pagination li a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.pagination li.active span {
    background: var(--primary-color);
    color: white;
}

.pagination li.disabled span {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    pointer-events: none;
}

@media screen and (max-width: 768px) {

    .pagination li a,
    .pagination li span {
        min-width: 35px;
        height: 35px;
        padding: 0 10px;
    }
}

@media screen and (max-width: 480px) {
    .pagination li:not(.active):not(:first-child):not(:last-child) {
        display: none;
    }
    
    .pagination {
        gap: 10px;
    }
}

/* AI桌布生成器样式 */
.ai-wallpaper-generator {
    position: relative;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

.generator-container {
    position: relative;
    z-index: 2;
}

.input-container textarea {
    height: 120px;
    resize: none;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: var(--dark-color);
}

.input-container textarea:focus {
    background-color: rgba(255, 255, 255, 1);
    box-shadow: 0 6px 15px rgba(142, 68, 173, 0.2);
}

.type-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.type-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.type-btn.type-active {
    background-color: white;
    color: var(--mobile-wallpaper-color);
    border-color: white;
    font-weight: bold;
}

#desktopType.type-active {
    color: var(--desktop-wallpaper-color);
}

#mobileType.type-active {
    color: var(--mobile-wallpaper-color);
}

.generate-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 0 4px 10px rgba(142, 68, 173, 0.3);
    transition: all 0.3s ease;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(142, 68, 173, 0.4);
}

.generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.generator-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(142, 68, 173, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    z-index: 10;
}

.progress-container {
    width: 80%;
    max-width: 400px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, var(--accent-color), var(--secondary-color));
    border-radius: 6px;
    transition: width 0.5s ease;
}

.progress-text {
    margin-top: 8px;
    text-align: center;
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.generator-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.result-container {
    width: 100%;
}

.image-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.05);
    max-height: 80vh;
}

.image-wrapper img {
    display: block;
    margin: 0 auto;
}

.img-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
}

.img-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(142, 68, 173, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.download-btn {
    background: linear-gradient(135deg, var(--accent-color) 0%, #C0392B 100%);
    transition: all 0.3s ease;
}

.download-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(231, 76, 60, 0.3);
}

.regenerate-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2980B9 100%);
    transition: all 0.3s ease;
}

.regenerate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.3);
}

.restart-btn {
    background: linear-gradient(135deg, var(--warning-color) 0%, #D35400 100%);
    transition: all 0.3s ease;
}

.restart-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(243, 156, 18, 0.3);
}

.download-btn:disabled, .regenerate-btn:disabled, .restart-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media screen and (max-width: 640px) {
    .ai-wallpaper-generator {
        max-width: 100%;
    }
    
    .input-container textarea {
        height: 100px;
    }
}

@media screen and (max-width: 480px) {
    .input-container .mt-3.flex {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .input-container label {
        margin-bottom: 0.5rem;
        margin-right: 0;
    }
    
    .type-selector {
        width: 100%;
    }
    
    .type-btn {
        flex: 1;
        text-align: center;
        justify-content: center;
    }
}

/* 手机预览功能 */
.mobile-frame-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 580px;
    z-index: 10;
}

.mobile-frame-detail-container {
    position: relative;
    width: 300px;
    height: 580px;
    margin: 0 auto;
}

.mobile-frame-detail-container .mobile-frame-content {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 10px;
}

.mobile-frame-detail-container .mobile-frame-content img,
.mobile-frame-detail-container .mobile-frame-content video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.mobile-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/static/images/mobile-frame.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    z-index: 5;
}

.preview-btn {
    background: linear-gradient(135deg, var(--info-color) 0%, #16a085 100%);
    transition: all 0.3s ease;
}

.preview-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(26, 188, 156, 0.3);
}

/* 用户信息侧边栏样式 */
.user-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.user-sidebar.active {
    visibility: visible;
    opacity: 1;
}

.user-sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    cursor: pointer;
}

.user-sidebar-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90vw;
    height: 100%;
    background-color: white;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.user-sidebar.active .user-sidebar-content {
    transform: translateX(0);
}

/* 用户头像按钮悬停效果 */
#userAvatarBtn:hover .w-8,
#mobileUserAvatarBtn:hover .w-8 {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Google登录按钮样式 */
#googleLoginBtn:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(142, 68, 173, 0.15);
}

/* 功能菜单项悬停效果 */
.user-sidebar .group:hover .w-10 {
    transform: scale(1.1);
}

/* 响应式设计 */
@media screen and (max-width: 640px) {
    .user-sidebar-content {
        width: 100%;
        max-width: 100%;
    }
}

/* 滚动条样式 */
.user-sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.user-sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.user-sidebar-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.user-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #7D3C98;
}

/* 防止页面滚动 */
body.overflow-hidden {
    overflow: hidden;
}

/* Toast提示信息样式 */
.toast-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 4px;
    z-index: 9999;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-warning {
    background-color: rgba(255, 152, 0, 0.9);
    border-left: 4px solid #ff6f00;
}

.toast-error {
    background-color: rgba(244, 67, 54, 0.9);
    border-left: 4px solid #d32f2f;
}

.toast-success {
    background-color: rgba(76, 175, 80, 0.9);
    border-left: 4px solid #388e3c;
}


.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
.mobile-card {
    aspect-ratio: 9/16;
}
.desktop-card {
    aspect-ratio: 16/9;
}

/* 类型和清晰度选择器样式 */
.type-btn, .quality-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    transition: all 0.3s ease;
}
.type-active, .quality-active {
    background-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.5);
}
.quality-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}
.quality-btn[disabled]:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 9999px;
    z-index: 1;
}